package com.td.teach.activity;

import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.td.teach.R;

public class Page7Activity extends BaseActivity {

    private MediaPlayer mp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_07);
    }

    public void voice_bi(View v){
        if(mp != null && mp.isPlaying()){
            mp.stop();
        }
        mp =  MediaPlayer.create(this,R.raw.bi);
        mp.start();
    }

    public void voice_bi_z(View v){
        if (mp != null && mp.isPlaying())
            mp.stop();
        mp =  MediaPlayer.create(this,R.raw.bi_z);
        mp.start();
    }

    protected void onDestroy() {
        // TODO Auto-generated method stub
        if(mp != null && mp.isPlaying()){
            mp.stop();
        }
        mp.release();//释放资源
        super.onDestroy();
    }

}
